<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改合作伙伴')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-partner-edit" th:object="${partner}">
            <input name="partnerId" th:field="*{partnerId}" type="hidden">
            <input name="deptId" th:field="*{deptId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">类型：</label>
                <div class="col-sm-8">
                    <select name="partnerType" class="form-control m-b" th:with="type=${@dict.getType('b_partner_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{partnerType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" id="cardNoRow">
                <label class="col-sm-3 control-label">企业税号：</label>
                <div class="col-sm-8">
                    <input name="cardNo" th:field="*{cardNo}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系人：</label>
                <div class="col-sm-8">
                    <input name="linkName" th:field="*{linkName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系电话：</label>
                <div class="col-sm-8">
                    <input name="linkPhone" th:field="*{linkPhone}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系地址：</label>
                <div class="col-sm-8">
                    <input name="linkAddress" th:field="*{linkAddress}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        let partner=[[${partner}]];
        if(partner.partnerType=='0'){
            $("#cardNoRow").show();
        }else{
            $("#cardNoRow").hide();
        }
        var prefix = ctx + "partner/partner";
        $("#form-partner-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-partner-edit').serialize());
            }
        }
    </script>
</body>
</html>
